<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Promise封装setTimeout定时器</title>
</head>
<body>
    <script>
        function timeout(delay = 1000){
            return new Promise(resolve => {
                setTimeout(resolve,delay);
            });
        }

        timeout(2000).then(
            value => {
                console.log("xiasnn");
                return timeout(2000);
            }
        ).then(
            value => {
                console.log("后盾人");
            }
        )
    </script>
</body>
</html>